package com.jilujia.domain.hotel;

import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.jilujia.domain.hotel.repository.HotelRepository;
import com.jilujia.framework.domain.AbstractPoEntityManager;

@Component
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
public class HotelManager extends AbstractPoEntityManager<Long, Hotel, HotelRepository> {

	@Transactional
	public Hotel saveHotel(Hotel hotel) {
		this.setInstance(hotel);
		this.save();
		return hotel;
	}

	public void addFollowCount(Long hotelId) {
		this.getRepository().addFollowCount(hotelId);
	}

	public void subFollowCount(Long hotelId) {
		this.getRepository().subFollowCount(hotelId);
	}
}
